import { Injectable } from '@angular/core';
import { BaseService } from './base.service';
import { DepartmentInfo } from '../models';

@Injectable({
  providedIn: 'root'
})
export class DepartmentService extends BaseService {
  //添加部门
  createDepartment(params: DepartmentInfo) {
    const url = 'api/department';
    return this.post(url, params);
  }
  //编辑部门
  updateDepartment(params: DepartmentInfo) {
    const url = 'api/department';
    return this.put(url, params);
  }
  //删除部门
  deleteDepartment(Id) {
    const url = 'api/department';
    return this.delete(`${url}/${Id}`);
  }
  //部门详情
  getDepartmentInfoById(Id) {
    const url = 'api/department';
    return this.get(`${url}/${Id}`);
  }
  //部门列表
  queryDepartmentsList(params?: { name?: string; status?: string; pageIndex?: number; countOfPage?: number; }) {
    const url = 'api/department';
    return this.get(url, { params });
  }
}
